#ifndef MAX

#define MAX(a,b) (((a->v)<(b->v))?(a):(b))

#endif

#ifndef SHENGYU

#define SHENGYU

typedef struct shengyu{
	unsigned char shyu,yshyu;
	unsigned long long lshyu;
}sy;

#endif

#ifndef BAO_JILU

#define BAO_JILU

typedef struct baojilu{
	FILE *fg,*ofg;
	char *name;
	long  start,len;
}bao;

#endif

#ifndef LONG_CODE

#define LONG_CODE

typedef struct longcode{
	unsigned char len;
	unsigned char val;
	long long *du;
	struct longcode *next;
}long_code;

#endif

#ifndef HAF_TREE

#define HAF_TREE

typedef struct haftree{
	unsigned char dq;
	struct haftree *l,*r;
	char *code;
	unsigned long v;
}haf;

#endif

#ifndef QUANJU_BIANLING

#define QUANJU_BIANLIANG

extern int code_sum;
extern int th;
extern unsigned char shyu;
extern unsigned long long lshyu;
extern unsigned char yshyu;
extern FILE *fg;
extern FILE *in;
extern bao *fgs;
extern int sum;
extern int namelen;
extern long size;
extern pthread_mutex_t du_mutex;
extern pthread_mutex_t xie_mutex;
extern pthread_mutex_t mutex;
extern pthread_mutex_t mutexr;//PTHREAD_MUTEX_INITIALIZER;
extern struct haftree arr[256];
extern char *code[256];
extern char *inname;
extern char **outname;
extern unsigned char  ***code_tab;
extern long_code ***lcode_tab;
extern pthread_cond_t cond;
extern pthread_cond_t xcond;

#endif

#ifndef LIDU_8

#define LIDU_8(buf,arr,i)  ++arr[buf[i]].v; arr[buf[i]].dq = buf[i];++sum; 

#endif

#ifndef HAF_CODE

#define HAF_CODE

void hafcode(struct haftree *,int);

#endif

#ifndef FILE_PINJIE

#define FILE_PINJIE


void filepinjie(unsigned char *,int,long,FILE *);

#endif


#ifndef HAF_DU

#define HAF_DU

void hafdu(unsigned char *,int,long,FILE *);

#endif

#ifndef HAF_OUT

#define HAF_OUT


sy hafout(sy,unsigned char *,int,long,FILE *);

#endif

#ifndef HAF_IN

#define HAF_IN

sy hafin(sy,unsigned char *,int,long,FILE *);

#endif

#ifndef OUT_OPEN

#define OUT_OPEN

FILE *out_open(char *);

#endif 

#ifndef XIE_TOU

#define XIE_TOU

void xietou(FILE *);

#endif

#ifndef IN_OPEN

#define IN_OPEN

void in_open(FILE *);

#endif

#ifndef X_Y

#define X_Y

int xy(int,int);

#endif
